from page_object.base_page import Actions
from page_object.login import Login
from page_object.register import Register
from utils.config import by
from utils.log import logger


class Home:
    def __init__(self, url: str, driver) -> None:
        self.driver = driver
        self.driver.get(url)
        self.url = url
        self._action = Actions(self.driver)

    def go_register(self, locator: str, by=by) -> Register:
        logger.info("go to register")
        self._action.send_key(by, locator)
        return Register(self.driver, self.url)

    def go_login(self, locator: str, by=by) -> Login:
        logger.info("go to login")
        self._action.send_key(by, locator)
        return Login(self.driver, self.url)
